/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import javax.swing.JLabel;
import javax.swing.JTextField;
import model.Book;
import model.Document;

/**
 *
 * @author Ira
 */
public class DocumentPropertiesBook extends DocumentPropertiesField {
	
	private JLabel lblNbPage = new JLabel("nbPage");
	private JLabel lblType = new JLabel("Type");
	private JTextField txtNbPage = new JTextField(13);
	private JTextField txtType = new JTextField(13);
	
	public DocumentPropertiesBook(boolean editable) {	
		super(editable);
		this.txtNbPage.setEditable(editable);
		this.txtType.setEditable(editable);
		this.add(this.lblType, "w 60!");
		this.add(this.txtType);
		this.add(this.lblNbPage, "w 60!");
		this.add(this.txtNbPage, "wrap");
	}

	@Override
	public void setContent(Document d) {
		this.txtNbPage.setText("" + ((Book)d).getNbPage());
		this.txtType.setText(((Book)d).getType());
	}

	@Override
	public void getContent(Document d) {
		Book b = (Book)d;
		b.setNbPage(Integer.parseInt(this.txtNbPage.getText()));
		b.setType(this.txtType.getText());
	}

	/**
	 * @return the txtNbPage
	 */
	public String getTxtNbPage() {
		return txtNbPage.getText();
	}

	/**
	 * @return the txtType
	 */
	public String getTxtType() {
		return txtType.getText();
	}
}
